from starlette.endpoints import HTTPEndpoint
from starlette.responses import JSONResponse
from database import Session, engine
import datetime
from dao import DaoPowerSupplyBureauList
from dao import DaoWorkRecord


class PowerSupplyBureauList(HTTPEndpoint):

    async def get(self, request):
        session = Session()
        try:
           bureauid = request.query_params["id"]
           return  DaoPowerSupplyBureauList.get_bureau_info(session, bureauid)
        finally:
            session.close()

class PowerSupplyBureauListAll(HTTPEndpoint):

    async def get(self, request):
        session = Session()
        try:
           return  DaoPowerSupplyBureauList.get_bureau_info_all(session)
        finally:
            session.close()